<admintpl file="header" />
<body class="J_scroll_fixed">
	<div class="wrap J_check_wrap">
	 <form class="form-horizontal js-ajax-form" name="myform" id="myform" action="#" method="post">
         <input type="hidden" id="secid" name="id" value="{$section2['id']}">
         <input type="hidden" name="cs_id" value="{$section2['cs_id']}">
         <div class="row-fluid">
             <div class="span9">
                 <table class="table table-bordered">
                     <tr>
                         <th width="80">课程资料</th>
                         <!--<td><script type="text/plain" id="sc_text" name="sc_text" style="width:100%;height:500px;"></script></td>-->
                         <td><textarea id="sc_text" name="sc_text" style="width:100%;height:500px;">{$section2['sc_text']}</textarea></td>
                     </tr>
                 </table>
             </div>
         </div>
         <div style="margin-top:40px;">
             <button id="submit" class="btn btn-primary" type="button">保存</button>
         </div>
	</form>
	</div>
<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/content_addtop.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/ueditor/ueditor.all.js"></script>
    <script type="text/javascript">
        $(function () {
            editorcontent = new baidu.editor.ui.Editor();
            editorcontent.render( 'sc_text' );
            try{editorcontent.sync();}catch(err){}

            $('#submit').click(function () {
                var data = {
                    id: $('#secid').val(),
                    sc_text: editorcontent.getContent(),
                };

                $.ajax({
                    type: "post",
                    url: "{:u('AdminSection2/edit_post')}",
                    dataType: "json",
                    data: data,
                    success: function (data) {
                        if(data.status){
                            setCookie("refersh_time",1);
                            //修改成功
                            Wind.use("artDialog", function () {
                                art.dialog({
                                    id: "succeed",
                                    icon: "succeed",
                                    fixed: true,
                                    lock: true,
                                    background: "#CCCCCC",
                                    opacity: 0,
                                    content: data.info,
                                    button:[
                                        {
                                            name: '确认',
                                            callback:function(){
                                                reloadPage(window);
                                                return true;
                                            },
                                            focus: true
                                        }
                                    ]
                                });
                            });
                        }else{
                            isalert(data.info);
                        }
                    }
                });
            });
        });
    </script>
</body>
</html>